#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;
typedef pair<int, int> PII;
void solve()
{
	int n;
	cin >> n;

	vector<int> a(n + 1);
	vector<PII> ans;
	int ma = -1e9, maxi, mi = 1e9, mini;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		if (a[i] > ma)
		{
			ma = a[i];
			maxi = i;
		}
		if (a[i] < mi)
		{
			mi = a[i];
			mini = i;
		}
	}
	if (ma <= 0)
	{
		for (int i = 0; i < 5; i++)
		{
			ans.push_back({ mini, mini });
			a[mini] += a[mini];
		}
		for (int i = 0; i < 5; i++)
		{
			ans.push_back({ n, mini });
			a[n] += a[mini];
		}
		for (int i = n - 1; i > 0; i--)
		{
			ans.push_back({ i, i + 1 });
			a[i] += a[i + 1];
		}
	}
	else
	{
		for (int i = 0; i < 5; i++)
		{
			ans.push_back({ maxi, maxi });
			a[maxi] += a[maxi];
		}
		for (int i = 0; i < 5; i++)
		{
			ans.push_back({ 1, maxi });
			a[1] += a[maxi];
		}
		for (int i = 2; i <= n; i++)
		{
			ans.push_back({ i, i - 1 });
			a[i] += a[i - 1];
		}
	}
	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++)
		cout << ans[i].first << ' ' << ans[i].second << endl;
}
int main()
{
	int t;
	cin >> t;
	while (t--)
		solve();
	return 0;
}